package com.woniu.rabbitMq.controller;

import com.woniu.common.dto.RechargeOrderDto;
import com.woniu.common.dto.RechargeOrderJiFenDto;
import com.woniu.common.dto.SkuOrderDto;
import com.woniu.common.dto.SkuOrderJifenDto;
import com.woniu.common.util.ResponseData;
import com.woniu.rabbitMq.service.RabbitService;
import io.swagger.annotations.Api;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequiredArgsConstructor
@Api("订单")
public class OrderController {
    @Autowired
    private  RabbitService rabbitService;


    /**
     * 话费充值
     */
    @PostMapping("/addRechargeOrder")
    public ResponseData<?> addRechargeOrder(@RequestBody RechargeOrderDto rechargeOrderDto){
        return rabbitService.addRechargeOrder(rechargeOrderDto);
    }

    /**
     * 商品下订单
     */
    @PostMapping("/addSkuOrder")
    public ResponseData<?> addSkuOrder(@RequestBody SkuOrderDto skuOrderDto) {
        return rabbitService.addSkuOrder(skuOrderDto);
    }

    /**
     * 积分充值
     */
    @PostMapping("/addRechargeOrderForJifen")
    public ResponseData<?> addRechargeOrderForJifen(@RequestBody RechargeOrderJiFenDto rechargeOrderDto){
        return rabbitService.addRechargeOrderForJifen(rechargeOrderDto);
    }

    /**
     * 积分话费充值
     */
    @PostMapping("/addJifenRechargeOrder")
    public ResponseData<?> addJifenRechargeOrder(@RequestBody RechargeOrderJiFenDto rechargeOrderDto){
        return rabbitService.addJifenRechargeOrder(rechargeOrderDto);
    }

    /**
     * 积分下订单
     */
    @PostMapping("/addSkuOrderForJifen")
    public ResponseData<?> addSkuOrderForJifen(@RequestBody SkuOrderJifenDto skuOrderJifenDto) {
        return rabbitService.addSkuOrderForJifen(skuOrderJifenDto);
    }
}
